#ifndef __tcp_h__
#define __tcp_h__ 1

enum
{
  TCP_ESTABLISHED = 1,
  TCP_SYN_SENT,
  TCP_SYN_RECV,
  TCP_FIN_WAIT1,
  TCP_FIN_WAIT2,
  TCP_TIME_WAIT,
  TCP_CLOSE,
  TCP_CLOSE_WAIT,
  TCP_LAST_ACK,
  TCP_LISTEN,
  TCP_CLOSING   /* now a valid state */
};


enum{
    TCP_SUCCESS = 0,
    TCP_ERR_SOCKET,
    TCP_ERR_CONNECT,
    TCP_ERR_IP_NONE,    
    TCP_ERR_TIMEOUT,    
};

typedef struct {
    uint32_t ip;
    uint16_t port;
    int timeout;
}tcp_arg_t;

typedef struct {
    int connected;
    float latency;
}tcp_result_t;

extern void* do_tcp(void *arg);
extern void tcp_result_print(tcp_result_t *result);
#endif